package org.personal.entity;

import java.util.LinkedList;
import java.util.List;

import org.myhibernate.annotation.MapProperty;
import org.myhibernate.annotation.MapTable;
import org.myhibernate.annotation.MapProperty.MapType;
import org.myhibernate.id.NumberID;

@MapTable(table="GROUPS")
public class Group 
{
	private String id="";
	private String name="";
	private String pid="";
	private List<String> groups=new LinkedList<String>();
	
	@MapProperty(map=MapType.FALSE)
	private List<String> children=new LinkedList<String>();
	@MapProperty(map=MapType.FALSE)
	private static Group admins=null;
	public static Group getAdmins() 
	{
		if (admins==null) {
			admins=new Group();
		}
		return admins;
	}
	public static void setAdmins(Group admins) {
		Group.admins = admins;
	}
	
	public String getId() 
	{
		if ((id==null)||("".equals(id))||("null".equalsIgnoreCase(id))) 
		{
			id=NumberID.getId(Group.class).toString();
		}
		return id;
	}
	public List<String> getChildren() {
		return children;
	}
	public void setChildren(List<String> children) {
		this.children = children;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPid() {
		return pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public List<String> getGroups() {
		return groups;
	}
	public void setGroups(List<String> groups) {
		this.groups = groups;
	}
}
